<template>
  <el-card class="router-box-card">
    <div slot="header" class="clearfix">
      <span class="card-title">系统通知</span>
      <el-button style="float: right; padding: 3px 0" type="text">清空所有消息</el-button>
    </div>
    <div class="card-content">
      <div class="notice-item" v-for="(item,index) in noticeList" :key="index">
        <div class="notice-item-top">
          <div class="notice-title">
            <span>【系统通知】{{item.title}}</span>
          </div>
          <div class="time">
            <span>{{item.time}}</span>
          </div>
        </div>
        <div class="notice-content" v-html="item.content">
        </div>
      </div>
    </div>
  </el-card>
</template>

<script>
import { getCurrentMessageUser } from '@/api/message/MessageUser'

export default {
  name: 'index',
  data(){
    return{
      noticeList:[
        // {
        //   title: '【系统】标题1',
        //   content: '这是一条系统通知内容1',
        //   time: '2022-11-8'
        // },
        // {
        //   title: '【系统】标题2',
        //   content: '这是一条系统通知内容2',
        //   time: '2022-11-8'
        // },
        // {
        //   title: '【系统】标题3',
        //   content: '这是一条系统通知内容3',
        //   time: '2022-11-8'
        // }
      ]
    }
  },
  created() {
    getCurrentMessageUser().then(res => {
      this.noticeList = res.data;
      console.log(res)
    })
  }
}
</script>

<style scoped>
.router-box-card{
  padding: 10px;
}

.card-title{
  font-size: 16px;
  font-weight: 600;
  color: #222226;
}
/*通知*/
.notice-item{
  padding: 10px 0;
}

.notice-item-top{
  display: flex;
  justify-content: space-between;
}

.notice-title{
  font-weight: 600;
}

.time{
  color: #99a;
}

.notice-content{
  background-color: #f7f7f7;
  padding: 10px;
  margin-top: 10px;
}
</style>
